<template>
  <div style="display: inline-block;">
    <el-button style="margin-bottom:10px" type="success" class="buttoncss" icon="el-icon-circle-check" circle title="转账" @click="open()"/>
    <el-dialog v-el-drag-dialog :visible.sync="dialogTableVisible" title="转账">
      <el-form ref="row_data" label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
        <el-form-item label="提现ID" prop="提现ID">
          <el-input v-model="row_data.id" :disabled="true" placeholder="提现ID"/>
        </el-form-item>
        <el-form-item label="转账金额" prop="转账金额">
          <el-input v-model="row_data.applyWithdrawMoney" placeholder="转账金额"/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm()">确定</el-button>
          <el-button @click="close()">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import elDragDialog from '@/directive/el-dragDialog' // base on element-ui
import store from '@/store'
import { transfers } from '@/api/merchant/merchant_withdrawal_record'
export default {
  inject: ['reload'],
  name: 'DragDialogDemo',
  directives: { elDragDialog },
  props: {
    row_data: {
      type: Object,
      default: function() {
        return null
      }
    }
  },
  data() {
    return {
      dialogTableVisible: false,
      content: ' '
    }
  },
  methods: {
    open() {
      this.dialogTableVisible = true
      console.log('row_data', this.row_data)
    },
    submitForm() {
      transfers(store.getters.token, this.row_data).then(res => {
        console.log(res)
        if (res.data.status === true) {
          this.$message({
            type: 'success',
            message: '转账成功!'
          })
          this.reload()
          this.close()
          this.$emit('getLists')
        } else {
          this.$message({
            type: 'info',
            message: '转账失败'
          })
          this.close()
        }
      })
    },
    close() {
      this.dialogTableVisible = false
    }
  }
}
</script>
